
    const nameInput = document.querySelector('#mobile_phone')
    const pwdInput = document.querySelector('#pwd')
	const repwdInput = document.querySelector('#repwd')
	const submitBtn = document.querySelector('input.regBtn')
	
    submitBtn.onclick = function () {
		
      const name = nameInput.value
      const pwd = pwdInput.value
	  const repwd = repwdInput.value
      // 带上用户名和密码向后端发送请求
      // { name: name, pwd: pwd } 在ES6里可以简写为{ name, pwd }
	  if(pwd === repwd){
		  
		  utils.post('http://localhost/liangcangProject/src/api/user/regist.php', { name, pwd }, resp => {
			  console.log(resp)
			  
			if (resp.code === 200) {
			  alert(resp.body.msg + '，即将跳转登录页')
			  location.href = '/html/login.html'
			} else {
			  // 注册失败
			  alert(resp.body.msg)
			}
		  })
	  
	  }else{
		  alert('密码与确认密码不同!')
	  }
      return false
    }


